package com.pengcheng.hnweb.config;

import com.pengcheng.hnweb.interceptor.Saveinterceptor;
import com.pengcheng.hnweb.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class MvcConfig implements WebMvcConfigurer {
    @Autowired
    private UserInterceptor userInterceptor;
    @Autowired
    private Saveinterceptor saveinterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login","/reg","/service/do_login","/respon","/test")
                .excludePathPatterns("/m/**")
                .excludePathPatterns("/service/**")
                .excludePathPatterns("/config/list_dlog")
                .excludePathPatterns("/public/**");
        registry.addInterceptor(saveinterceptor)
                .addPathPatterns("/service/fupdate");
    }
}
